package com.itheima.controller;

import com.itheima.pojo.Clazz;
import com.itheima.pojo.ClazzNumberData;
import com.itheima.pojo.EmpJobData;
import com.itheima.pojo.Result;
import com.itheima.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/report")
public class ReportController {
    @Autowired
    private ReportService reportService;

    //5.1 员工性别统计
    @GetMapping("/empGenderData")
    public Result employeeGenderStats() {
        log.info("统计员工性别信息");
        List<Map> genderList = reportService.employeeGenderStats();
        return Result.success(genderList);
    }

    //5.2 员工职位人数统计
    @GetMapping("/empJobData")
    public Result employeePositionCount() {
        log.info("员工职位人数统计");
        EmpJobData jobData = reportService.employeePositionCount();
        return Result.success(jobData);
    }

    //5.3 学员学历统计
    @GetMapping("/studentDegreeData")
    public Result studentEducationStats() {
        List<Map> studentList = reportService.studentEducationStats();
        return Result.success(studentList);
    }
    //5.4 班级人数统计
    @GetMapping("/studentCountData")
    public  Result classStudentCount(){

        ClazzNumberData clazzNumberData = reportService.classStudentCount();
        return Result.success(clazzNumberData);
    }
}